echo "============= 关停服务 ================"

pid1=`ps -ef | grep youZone-1.0-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`

if [ -n "$pid1" ]
then
   echo "kill -15 的pid:" $pid1
   kill -15 $pid1

   sleep 10
fi

echo "再次检测PID"
pid1=`ps -ef | grep youZone-1.0-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid1" ]
then
   echo "kill -9 的pid:" $pid1
   kill -9 $pid1
fi

echo "============= 关停服务完成 ================"

echo "启动 yonZone"

echo "JAVA_HOME: " $JAVA_HOME

JAVA_HOME=/opt/ProgramSoft/jdk-21.0.6+7 \
PATH=$JAVA_HOME/bin:$PATH \
nohup java -jar -Dspring.profiles.active=prd \
-DfrogSecondTime=10 \
-Dotel.service.name=youZone-AliNode \
-javaagent:lib\opentelemetry-javaagent-2.14.0.jar \
-Dotel.exporter.otlp.protocol=http/protobuf \
-Dotel.exporter.otlp.endpoint=http://8.134.176.152:4318 \
-Dotel.metrics.exporter=none \
-Dotel.traces.exporter=none \
./youZone-1.0-SNAPSHOT.jar &
